#!/bin/bash

REGISTRY_URL="registry.cn-hangzhou.aliyuncs.com"
NAME_SPACE="ksami"
BUILD_TAG="1.0"

if [ "$1" != "" ];
    then
    BUILD_TAG="$1"
fi

REGISTRY_URL="registry.cn-hangzhou.aliyuncs.com"
docker login --username=$DOCKER_REPO_USERNAME $REGISTRY_URL --password=$DOCKER_REPO_PASSWORD


set -e
docker build -t milk_cup:$BUILD_TAG .
docker tag milk_cup:$BUILD_TAG $REGISTRY_URL/$NAME_SPACE/milk_cup:$BUILD_TAG
docker push $REGISTRY_URL/$NAME_SPACE/milk_cup:$BUILD_TAG
docker rmi milk_cup:$BUILD_TAG
docker rmi $REGISTRY_URL/$NAME_SPACE/milk_cup:$BUILD_TAG


